package com.yuan;

public class Main {
    public static void main(String[] args) {

        // simple demo test here, more test in IntensitySegmentsTest.java
        IntensitySegments segments = new IntensitySegments();
        System.out.println(segments); // expected output: "[]"

        // Basic scenario
        segments.add(10, 30, 1);
        System.out.println(segments); // Expected output: "[[10,1],[30,0]]"
        segments.add(20, 40, 1);
        System.out.println(segments); // Expected output: "[[10,1],[20,2],[30,1],[40,0]]"
        segments.add(10, 40, -2);
        System.out.println(segments); // Expected output: "[[10,-1],[20,0],[30,-1],[40,0]]"

        // Boundary case: from and to are equal
        segments = new IntensitySegments();
        segments.add(10, 10, 1);
        System.out.println(segments); // Expected output: "[]"

        // Boundary case: amount is 0
        segments = new IntensitySegments();
        segments.add(10, 30, 0);
        System.out.println(segments); // Expected output: "[]"

        // Boundary case: covering all existing intervals
        segments = new IntensitySegments();
        segments.add(10, 30, 1);
        segments.add(5, 40, 1);
        System.out.println(segments); // Expected output: "[[5,1],[10,2],[30,1],[40,0]]"

        // Boundary case: negative interval
        segments = new IntensitySegments();
        segments.add(-10, 10, 1);
        System.out.println(segments); // Expected output: "[[-10,1],[10,0]]"

    }
}